package com.htu.courseService.auth.strategy;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created By JNNarrator on 2024/9/7 16:45
 * email: jiangn09@chinatelecom.cn
 */
@Component
@RequiredArgsConstructor
public class LoginFactory implements InitializingBean {
	private final Map<String, LoginStrategy> loginStrategyMap;
	Map<String,LoginStrategy> strategys = new ConcurrentHashMap<>();
	@Override
	public void afterPropertiesSet() throws Exception {
		strategys.putAll(loginStrategyMap);
	}
	public LoginStrategy getLoginStrategy(String type)
	{
		return strategys.get(type);
	}
}
